#include <cctype>
#include <iostream>
#include <fstream>
#include <string>
#include <map>

using std::endl;
using std::string;
using std::map;
using std::ifstream;
using std::ofstream;
using std::cerr;

class Dictionary{
public:
    Dictionary(const string &read_filename)
    {
        read(read_filename);
        store("dictionay.txt");
    }

    //判断是不是数字
    bool is_digit(const string &word){
        for(auto &it:word){
            if(isdigit(it)){
                return true;
            }
        }
        return false;
    }

    void read (const string &read_filename){
        ifstream ifs(read_filename);
        if(!ifs.good()){
            cerr<<read_filename<<" is not found"<<endl;
            return;
        }

        string word;
        while(ifs>>word){
            if(!is_digit(word)){
           ++_word[word];
            }
        }
    }
    
    void store (const string &store_filename){
        ofstream ofs(store_filename);
        for(auto &it:_word){
            ofs<<it.first<<" "<<it.second<<endl;
        }    
    }

private:
    map<string,int> _word;
};

void test(){
Dictionary d1("The_Holy_Bible.txt");
}

int main()
{
    

    test ();
    return 0;
}

